package xinxin.com.MementoPatternBasic;

import xinxin.com.MementoPatternBasic.Caretaker.Caretaker;
import xinxin.com.MementoPatternBasic.Originator.Originator;

/**
 * @author ：史鑫鑫
 * @date ：Created in 2019/3/28 13:32
 */
public class MementoPatternBasic {
    public static void main(String[] args) {
        Originator originator = new Originator();
        originator.setState("On");
        originator.Show();

        Caretaker caretaker = new Caretaker();
        caretaker.setMemento(originator.CreateMemento());

        originator.setState("Off");
        originator.Show();

        originator.SetMemento(caretaker.getMemento());
        originator.Show();
    }
}
